var express = require('express');
var router = express.Router();

// var Users = require('./models');

/* GET users listing. */
/*router.get('/', function(req, res, next) {
  res.send('respond with a resource');
});*/

var users = {
	'Joyce': '123456',
	'admin': 'admin'
}

//登录
router.post('/login', async function(req, res, next){
	let {username, password} = req.body;
	if(users[username] && (users[username]===password)) {
		req.session.username = username;
		res.send({status: '0'});
	} else {
		res.send({status: '-1'});
	}
})

module.exports = router;
